package com.xzc.one.test.main;

import com.xzc.one.common.util.FileOperator;
import com.xzc.one.common.util.ToolUtil;
import com.xzc.one.test.model.Person;
import com.xzc.one.test.model.SysCheckRelateProject;

import java.lang.reflect.Field;
import java.util.*;

/**
 * @Authr: xingzhicong
 * @Date: 2020/6/3
 * @Description:
 */
public class One {
    public static void main(String[] args) {
        //aaa();
        // bbb();
        // ccc();
        //ddd();
//        System.out.println(new Param().toString());
//        System.out.println(MyClass.BaseClass.create().toString());
//        String json = JSON.toJSONString(new Student(1, "a"));//关键
//        System.out.println(json);
        eee(SysCheckRelateProject.class);
    }

    public static void eee(Class clazz) {
        StringBuffer stringBuffer = new StringBuffer("{");
        Field[] fields = clazz.getDeclaredFields();//得到所有属性
        for (int i = 0; i < fields.length; i++) {//遍历
            Field field = fields[i];//得到属性
            field.setAccessible(true); //打开私有访问
            String name = field.getName();//获取属性
            stringBuffer.append("\"").append(name).append("\"").append(":").append("1,").append("\n");//一个个赋值
        }
        int lastIndex = stringBuffer.lastIndexOf(",");//获取最后一个逗号的位置
        String result = stringBuffer.substring(0, lastIndex) + "}"; //不要最后一个逗号","+"}"
        System.out.println(result);
    }

    public static void ccc() {
        Person person = new Person();
        person.setUsername("a");
        person.setPassword("aaa");
        person.setGenderStatus(1);
        Person person1 = new Person();
        person1.setUsername("a");
        person1.setPassword("aaa");
        person1.setGenderStatus(1);
        HashSet<Object> objects = new HashSet<>();
        objects.add(person);
        objects.add(person1);
        System.out.println(objects.size());
    }

    public static void bbb() {
        FileOperator.copyFilesToOneDir("E:\\qq\\634786617\\Image\\Group2", "E:\\qq\\634786617\\Image\\Group2\\image\\");
        //FileOperator.changeSuffix("E:\\bbb\\main", ".txt");
    }

}
